const axios = require("axios");
const { log } = require("console");
const fs = require("fs");
const path = require("path");

const imgFolderPath = path.join(__dirname, "imgs");

fs.mkdirSync(imgFolderPath);

const imageUrlArray = [
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240322/04df1ee1d608e9c0815bc89ede46f2a7.jpeg",
    memberId: "r.yao",
    submitTime: "2024-03-22 16:42:42",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240322/e13919accf48a614e01fd0a68fd0c7d1.jpeg",
    memberId: "xu.b.jiang",
    submitTime: "2024-03-22 16:50:34",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/8b4199df96248cbb7c027e6262a05fb1.jpeg",
    memberId: "yina.zhai",
    submitTime: "2024-03-26 08:28:52",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/a230dd386d391e334aaa57c3a63b670e.jpeg",
    memberId: "yanfei.ma",
    submitTime: "2024-03-26 08:46:04",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/d8b32b156dfe4dd9e84c6be4b95f6ea7.jpeg",
    memberId: "jing.c.sun",
    submitTime: "2024-03-26 08:59:12",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/e760c3891985a601ddcd672adb020647.jpeg",
    memberId: "keying.shi",
    submitTime: "2024-03-26 09:01:15",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/f1b13b68301eb5058086feebfd746403.jpeg",
    memberId: "yuting.chen",
    submitTime: "2024-03-26 09:04:58",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/d55e157845b9252f9cf9241b63b553d6.jpeg",
    memberId: "fuqiang.sui",
    submitTime: "2024-03-26 09:09:47",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/153afb24579412b037d9437e2e109015.jpeg",
    memberId: "sonya.shuyao.li",
    submitTime: "2024-03-26 09:11:45",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/66c76df1b8693a135a8b96b66f942162.jpeg",
    memberId: "dandan.c.li",
    submitTime: "2024-03-26 09:13:38",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/cc57cbbc16034081072fc19e09de249f.jpeg",
    memberId: "anzhu.jiang",
    submitTime: "2024-03-26 09:22:09",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/77645c25ad6bbdaf148346b7eda91574.jpeg",
    memberId: "zilun.zhang",
    submitTime: "2024-03-26 09:30:11",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/754d93f206654284d2cd13a93875f13c.jpeg",
    memberId: "yining.song",
    submitTime: "2024-03-26 09:35:20",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/ef65d6d97f232cf0e314f43e921ef01b.jpeg",
    memberId: "siyu.lu",
    submitTime: "2024-03-26 09:35:54",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/f01b5ce3de8f98cff2558c604cdff42d.jpeg",
    memberId: "dongmei.a.xu",
    submitTime: "2024-03-26 09:37:13",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/2a7407a6a6d52525d06a93ef84ddc634.jpeg",
    memberId: "he.bai",
    submitTime: "2024-03-26 09:37:22",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/98537b27b4306825e4f5033d9bad38b5.jpeg",
    memberId: "meichen.c.liu",
    submitTime: "2024-03-26 09:38:00",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/ce79db7cbc95d387abb800eed77cea7a.jpeg",
    memberId: "wenjiao.wang",
    submitTime: "2024-03-26 09:38:47",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/fbad7e361dcfa7788d11fccff0e91881.jpeg",
    memberId: "zixuan.cai",
    submitTime: "2024-03-26 09:39:55",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/841c002ff4891e5f87b5f897d9dc1717.jpeg",
    memberId: "xi.g.wang",
    submitTime: "2024-03-26 09:42:12",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/25ce7b3203c5f6bd08e0d40c7ef144f1.jpeg",
    memberId: "yu.f.li",
    submitTime: "2024-03-26 09:49:10",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/249748251152e1119e853f5a8f1608c6.jpeg",
    memberId: "zhiyuan.qu",
    submitTime: "2024-03-26 09:52:01",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/5931faab7a823b9a1fa9af06fa1e0133.jpeg",
    memberId: "songchen.huang",
    submitTime: "2024-03-26 09:55:38",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/dfd0709a6bb52b172c43c5ff56548aa0.jpeg",
    memberId: "kenny.suqian.ju",
    submitTime: "2024-03-26 09:57:40",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/4149fe262066138d05bd21164433e01d.jpeg",
    memberId: "chengshuai.wei",
    submitTime: "2024-03-26 10:10:51",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/6f252fc307ca987b89fd48ad7b23f6a2.jpeg",
    memberId: "fengzhi.luan",
    submitTime: "2024-03-26 10:13:00",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/aa5f1c9133c2d1461dd5fe509a1d767e.jpeg",
    memberId: "wenying.gu",
    submitTime: "2024-03-26 10:14:28",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/08237f3edd1a875e12c141715951e8fa.jpeg",
    memberId: "nettie.xiaona.li",
    submitTime: "2024-03-26 10:19:48",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/c37c272b2651bc033f93ce4bd455af03.jpeg",
    memberId: "haomin.wang",
    submitTime: "2024-03-26 10:24:35",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/0f6f3deff9206d819658b8cfe22bb76a.jpeg",
    memberId: "ruijian.dong",
    submitTime: "2024-03-26 10:26:08",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/925220df803635ab16fac48bec9468bd.jpeg",
    memberId: "xiangui.deng",
    submitTime: "2024-03-26 10:26:09",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/6d415c3420c5ed1d96a5db9abe5bf896.jpeg",
    memberId: "jianning.bian",
    submitTime: "2024-03-26 10:28:34",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/bcdb7bfc0076de0f9aeef902298cb7f3.jpeg",
    memberId: "jingjian.yang",
    submitTime: "2024-03-26 10:35:54",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/902a878894d3cfaf6569f1930b03bee1.jpeg",
    memberId: "ying.c.sun",
    submitTime: "2024-03-26 10:36:25",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/c0381295b85f29dae9839c3690f5ea59.jpeg",
    memberId: "qingmin.tan",
    submitTime: "2024-03-26 10:39:07",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/1e4acb5418de403262c5187c1e90ad97.jpeg",
    memberId: "xinyu.j.li",
    submitTime: "2024-03-26 10:51:03",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/29263d00c66e80368875091b6925eb55.jpeg",
    memberId: "yuqing.luo",
    submitTime: "2024-03-26 11:09:22",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/5a849467045715fb96bd5e755ebde09d.jpeg",
    memberId: "yudong.a.yang",
    submitTime: "2024-03-26 12:24:25",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/8e737376eba2db090644f051c73e464a.jpeg",
    memberId: "anqi.deng",
    submitTime: "2024-03-26 12:46:33",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/948e0f2214c2e24b7610b195af09e8f5.jpeg",
    memberId: "junhui.lan",
    submitTime: "2024-03-26 13:05:40",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/2ae459cc47f04aa67bf7b761bf557c85.jpeg",
    memberId: "yuan.e.zhou",
    submitTime: "2024-03-26 13:38:10",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/f699dff24c1ad1e3b612a6fee8fb08e0.jpeg",
    memberId: "cheng.a.yu",
    submitTime: "2024-03-26 13:39:50",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/3b92ada032b102b58195855374e2f8c5.jpeg",
    memberId: "hongyan.li",
    submitTime: "2024-03-26 14:06:10",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/a5dd00d07993fab512b3fea2087f7cb7.jpeg",
    memberId: "jiwei.dong",
    submitTime: "2024-03-26 14:09:14",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/5e867703ccc153599f30d3065a1d984d.jpeg",
    memberId: "fuyu.luan",
    submitTime: "2024-03-26 15:18:52",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/958c3024cdb9ad62edd6fcfeb9ca816a.jpeg",
    memberId: "xin.c.chen",
    submitTime: "2024-03-26 15:27:00",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/2859b2a49ecc8972bb29c0a7bf380838.jpeg",
    memberId: "chunna.wang",
    submitTime: "2024-03-26 15:36:47",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/2e35c110a69ec0cbf79e507af4078c29.jpeg",
    memberId: "huihui.zheng",
    submitTime: "2024-03-26 15:39:50",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/2a09e288599d4e5e2b61e08b47a56918.jpeg",
    memberId: "na.miao",
    submitTime: "2024-03-26 16:32:48",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/6f49be163b0d567208dd39c27be60060.jpeg",
    memberId: "kunsong.xue",
    submitTime: "2024-03-26 16:35:23",
  },
  {
    "d8439651-e161-6eef-0e07-400c1a981099":
      "https://myops.accenture.cn/fs_prod/files/myops-activity-assist/20240326/5f9dabe2f40fe83904aaf677fd80f3f0.jpeg",
    memberId: "yuanyuan.a.xu",
    submitTime: "2024-03-26 16:36:13",
  },
];

imageUrlArray.forEach((imgOpt) => {
  const filename = imgOpt.memberId;

  const urlKey = Object.keys(imgOpt).find(el => el!=='memberId'&&el!=='submitTime')
  const url = imgOpt[urlKey]

  const imgPath = path.join(imgFolderPath, filename + '.png');

  axios({
    method: "get",
    url,
    responseType: "stream",
  })
    .then((response) => {
      response.data.pipe(fs.createWriteStream(imgPath));
      console.log('filename'+'下载成功')
    })
    .catch((error) => {
      console.error(`下载 ${url} 失败：`, error);
    });
});
